package leetcode.字符串;

public class 有效的字母异位词242 {
    public boolean isAnagram(String s, String t) {
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            int index = t.indexOf(c);
            if(index < 0)
                return false;
            t = t.replaceFirst(""+c,"");
        }
        return t.length() == 0;

    }

    public static void main(String[] args) {
        new 有效的字母异位词242().isAnagram("anagram","nagaram");
    }
}
